﻿using System;
using System.Text;
using System.Web.Mvc;
using Nop.Core;
using Nop.Core.Infrastructure;
using System.Text.RegularExpressions;

namespace Nop.Web.Extensions
{
    public static class StringExtensions
    {
        static Regex re = new Regex("<[^>]*>");

        public static string Sub(this string source,int length)
        {
            string ret = string.Empty;
            if (source.Length == 0 || length > source.Length)
            {
                return source;
            }
            ret = source.Substring(0, length) + "...";
            return ret;
        }

        public static string RemoveHtml (this string source)
        {
            return re.Replace(source, "");
        }
    }
}